package com;

import com.netflix.client.config.IClientConfig;
import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;

//自定义负载均衡策略
public class CustomArithmetic {

    @Autowired
    private IClientConfig iClientConfig;

    @Bean
    public IRule ribbonRule(IClientConfig iClientConfig){
        //  RoundRobinRule  轮询
        return new RandomRule();//返回随机算法
    };
}
